package cn.iocoder.yudao.module.jky.dal.mysql.goods;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.jky.dal.dataobject.goods.GoodsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.jky.controller.admin.goods.vo.*;

/**
 * 商品 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface GoodsMapper extends BaseMapperX<GoodsDO> {

    default PageResult<GoodsDO> selectPage(GoodsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<GoodsDO>()
                .eqIfPresent(GoodsDO::getCatId, reqVO.getCatId())
                .likeIfPresent(GoodsDO::getGoodsName, reqVO.getGoodsName())
                .eqIfPresent(GoodsDO::getGoodsCode, reqVO.getGoodsCode())
                .eqIfPresent(GoodsDO::getImg, reqVO.getImg())
                .eqIfPresent(GoodsDO::getTmpImg, reqVO.getTmpImg())
                .eqIfPresent(GoodsDO::getVideo, reqVO.getVideo())
                .eqIfPresent(GoodsDO::getVideoUrl, reqVO.getVideoUrl())
                .eqIfPresent(GoodsDO::getDescription, reqVO.getDescription())
                .eqIfPresent(GoodsDO::getContent, reqVO.getContent())
                .eqIfPresent(GoodsDO::getBrandId, reqVO.getBrandId())
                .eqIfPresent(GoodsDO::getIsShow, reqVO.getIsShow())
                .eqIfPresent(GoodsDO::getIsTop, reqVO.getIsTop())
                .eqIfPresent(GoodsDO::getIsSale, reqVO.getIsSale())
                .eqIfPresent(GoodsDO::getIsDiscount, reqVO.getIsDiscount())
                .eqIfPresent(GoodsDO::getSort, reqVO.getSort())
                .eqIfPresent(GoodsDO::getClicknum, reqVO.getClicknum())
                .eqIfPresent(GoodsDO::getOldPrice, reqVO.getOldPrice())
                .eqIfPresent(GoodsDO::getCostPrice, reqVO.getCostPrice())
                .eqIfPresent(GoodsDO::getPrice, reqVO.getPrice())
                .eqIfPresent(GoodsDO::getProfitRatio, reqVO.getProfitRatio())
                .eqIfPresent(GoodsDO::getCommissionRatio, reqVO.getCommissionRatio())
                .eqIfPresent(GoodsDO::getPostage, reqVO.getPostage())
                .eqIfPresent(GoodsDO::getInventory, reqVO.getInventory())
                .eqIfPresent(GoodsDO::getGivePoint, reqVO.getGivePoint())
                .eqIfPresent(GoodsDO::getDeductionPoint, reqVO.getDeductionPoint())
                .eqIfPresent(GoodsDO::getIsSku, reqVO.getIsSku())
                .eqIfPresent(GoodsDO::getSkuStr, reqVO.getSkuStr())
                .eqIfPresent(GoodsDO::getSalesVolume, reqVO.getSalesVolume())
                .eqIfPresent(GoodsDO::getVirtualVolume, reqVO.getVirtualVolume())
                .betweenIfPresent(GoodsDO::getCreatetime, reqVO.getCreatetime())
                .eqIfPresent(GoodsDO::getIsDelete, reqVO.getIsDelete())
                .eqIfPresent(GoodsDO::getType, reqVO.getType())
                .eqIfPresent(GoodsDO::getBigPrice, reqVO.getBigPrice())
                .eqIfPresent(GoodsDO::getProffer, reqVO.getProffer())
                .eqIfPresent(GoodsDO::getFhSmall, reqVO.getFhSmall())
                .eqIfPresent(GoodsDO::getSxSmall, reqVO.getSxSmall())
                .eqIfPresent(GoodsDO::getSupplierId, reqVO.getSupplierId())
                .eqIfPresent(GoodsDO::getBanNum, reqVO.getBanNum())
                .eqIfPresent(GoodsDO::getInteBili, reqVO.getInteBili())
                .orderByDesc(GoodsDO::getGoodsId));
    }

    default List<GoodsDO> selectList(GoodsExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<GoodsDO>()
                .eqIfPresent(GoodsDO::getCatId, reqVO.getCatId())
                .likeIfPresent(GoodsDO::getGoodsName, reqVO.getGoodsName())
                .eqIfPresent(GoodsDO::getGoodsCode, reqVO.getGoodsCode())
                .eqIfPresent(GoodsDO::getImg, reqVO.getImg())
                .eqIfPresent(GoodsDO::getTmpImg, reqVO.getTmpImg())
                .eqIfPresent(GoodsDO::getVideo, reqVO.getVideo())
                .eqIfPresent(GoodsDO::getVideoUrl, reqVO.getVideoUrl())
                .eqIfPresent(GoodsDO::getDescription, reqVO.getDescription())
                .eqIfPresent(GoodsDO::getContent, reqVO.getContent())
                .eqIfPresent(GoodsDO::getBrandId, reqVO.getBrandId())
                .eqIfPresent(GoodsDO::getIsShow, reqVO.getIsShow())
                .eqIfPresent(GoodsDO::getIsTop, reqVO.getIsTop())
                .eqIfPresent(GoodsDO::getIsSale, reqVO.getIsSale())
                .eqIfPresent(GoodsDO::getIsDiscount, reqVO.getIsDiscount())
                .eqIfPresent(GoodsDO::getSort, reqVO.getSort())
                .eqIfPresent(GoodsDO::getClicknum, reqVO.getClicknum())
                .eqIfPresent(GoodsDO::getOldPrice, reqVO.getOldPrice())
                .eqIfPresent(GoodsDO::getCostPrice, reqVO.getCostPrice())
                .eqIfPresent(GoodsDO::getPrice, reqVO.getPrice())
                .eqIfPresent(GoodsDO::getProfitRatio, reqVO.getProfitRatio())
                .eqIfPresent(GoodsDO::getCommissionRatio, reqVO.getCommissionRatio())
                .eqIfPresent(GoodsDO::getPostage, reqVO.getPostage())
                .eqIfPresent(GoodsDO::getInventory, reqVO.getInventory())
                .eqIfPresent(GoodsDO::getGivePoint, reqVO.getGivePoint())
                .eqIfPresent(GoodsDO::getDeductionPoint, reqVO.getDeductionPoint())
                .eqIfPresent(GoodsDO::getIsSku, reqVO.getIsSku())
                .eqIfPresent(GoodsDO::getSkuStr, reqVO.getSkuStr())
                .eqIfPresent(GoodsDO::getSalesVolume, reqVO.getSalesVolume())
                .eqIfPresent(GoodsDO::getVirtualVolume, reqVO.getVirtualVolume())
                .betweenIfPresent(GoodsDO::getCreatetime, reqVO.getCreatetime())
                .eqIfPresent(GoodsDO::getIsDelete, reqVO.getIsDelete())
                .eqIfPresent(GoodsDO::getType, reqVO.getType())
                .eqIfPresent(GoodsDO::getBigPrice, reqVO.getBigPrice())
                .eqIfPresent(GoodsDO::getProffer, reqVO.getProffer())
                .eqIfPresent(GoodsDO::getFhSmall, reqVO.getFhSmall())
                .eqIfPresent(GoodsDO::getSxSmall, reqVO.getSxSmall())
                .eqIfPresent(GoodsDO::getSupplierId, reqVO.getSupplierId())
                .eqIfPresent(GoodsDO::getBanNum, reqVO.getBanNum())
                .eqIfPresent(GoodsDO::getInteBili, reqVO.getInteBili())
                .orderByDesc(GoodsDO::getGoodsId));
    }

}
